import { FormConfig } from '@/components'
import { Row } from '@/components/FTable/components/search'
import { configCurryFilter } from '@/dictionaries/filter'
import { BaseDto, Status } from '@/interfaces'
import { isTrue } from '@/utils/tools'
import { UserState } from '@/views/user/list/uilts'
import dayjs from 'dayjs'
import { shallowRef } from 'vue'
/*
 * @Description:
 * @Author: fhw
 * @Date: 2023-02-23 14:41:28
 */
export enum OperationRecordType {
	/** 管理员用户 */
	adminUser = 'adminUser',
	/** 纪念日 */
	anniversaries = 'anniversaries',
	/** 清单 */
	checklists = 'checklists',
	/** 时光邮件 */
	postOffice = 'postOffice',
	/** 相册 */
	photoAlbum = 'photoAlbum',
	/** 用户 */
	user = 'user',
	/** 日记 */
	diaries = 'diaries',
	/** 情侣关系 */
	couple = 'couple',
	/** 纪念日 */
	anniversary = 'anniversary',
	/** 图片上传 */
	upload = 'upload',
	/** 系统设置 */
	seting = 'seting',
	/** 菜单 */
	menu = 'menu',
	/** 菜单按钮 */
	menuButton = 'menuButton',
	/** 角色 */
	role = 'role',
}
export enum MethodType {
	GET = 'GET',
	POST = 'POST',
	PUT = 'PUT',
	DELETE = 'DELETE',
	PATCH = 'PATCH'
}
export interface OperationRecordState extends BaseDto {
	/** 操作用户ID */
	userId?: number
	/** 操作数据ID */
	dataId?: number
	/** 操作名称 */
	name?: string
	/** 接口路径 */
	interfacePath?: string
	/** 操作名称 */
	method?: MethodType
	/** 操作内容 */
	operation?: string
	/** ip */
	ip?: string
	/** 操作类型 */
	operateType?: OperationRecordType
}
export const columns: F.TableColumns[] = [
	{
		title: 'id',
		key: 'id',
		dataIndex: 'id',
		align: 'center',
		width: 60
	},
	{
		title: '操作用户',
		key: 'userId',
		dataIndex: 'userId',
		align: 'center',
		width: 200
	},
	{
		title: '操作名称',
		key: 'name',
		dataIndex: 'name',
		align: 'center',
		width: 200
	},
	{
		title: '接口路径',
		key: 'interfacePath',
		dataIndex: 'interfacePath',
		align: 'center',
		width: 200
	},
	{
		title: '操作内容',
		key: 'operation',
		dataIndex: 'operation',
		align: 'center',
		width: 200
	},
	{
		title: '请求方式',
		key: 'method',
		dataIndex: 'method',
		align: 'center',
		width: 200
	},
	{
		title: '操作类型',
		key: 'operateType',
		dataIndex: 'operateType',
		align: 'center',
		width: 200
	},
	{
		title: '操作表',
		key: 'outside',
		dataIndex: 'outside',
		align: 'center',
		width: 200
	},
	{
		title: 'ip',
		key: 'ip',
		dataIndex: 'ip',
		align: 'center',
		width: 200
	},
	{
		title: '创建时间',
		key: 'createDate',
		dataIndex: 'createDate',
		align: 'center',
		width: 200,
		customRender: ({ record }: F.RableSlotScope<BaseDto>) =>
			record.createDate && dayjs(record.createDate).format('YYYY-MM-DD HH:mm:ss'),
	},
]
export const rows: Array<Row> = [
	{
		title: '操作名称',
		key: 'name',
		component: 'a-input',
	},
	{
		title: '接口路径',
		key: 'interfacePath',
		component: 'a-input',
	},
	{
		title: '操作名称',
		key: 'method',
		component: 'a-input',
	},
	{
		title: 'ip',
		key: 'ip',
		component: 'a-input',
	},
	{
		title: '操作类型',
		key: 'operateType',
		component: 'a-input',
	},
]